package com.wm.wmim.server.dbservice.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wm.wmim.server.dao.UserInfoDao;
import com.wm.wmim.server.dbservice.UserInfoDbService;
import com.wm.wmim.server.entity.UserInfoDO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author weiming
 * @date 2024/8/27 20:59
 * @description
 */
@Service
public class UserInfoDbServiceImpl  extends ServiceImpl<UserInfoDao, UserInfoDO> implements UserInfoDbService {

    @Override
    public UserInfoDO getByUserCode(String userCode) {
        LambdaQueryWrapper<UserInfoDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserInfoDO::getUserCode, userCode);
        queryWrapper.last("limit 1");
        return this.getOne(queryWrapper);
    }

    @Override
    public List<UserInfoDO> listByUserCode(List<String> userCodeList) {
        LambdaQueryWrapper<UserInfoDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(UserInfoDO::getUserCode, userCodeList);
        return this.list(queryWrapper);
    }
}
